package games.flvPlayer.data
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class PlayerShowInfo extends EventDispatcher
	{
		private var m_width:Number;
		private var m_height:Number;
		private var m_x:Number;
		private var m_y:Number;
		
		public function PlayerShowInfo(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public function get width():Number
		{
			return m_width;
		}
		
		public function get height():Number
		{
			return m_height;
		}
		
		public function get x():Number
		{
			return m_x;
		}
		
		public function get y():Number
		{
			return m_y;
		}
		
		public function set width(n:Number):void
		{
			m_width = n;
		}
		
		public function set height(n:Number):void
		{
			m_height = n;
		}
		
		public function set x(n:Number):void
		{
			m_x = n;
		}
		
		public function set y(n:Number):void
		{
			m_y = n;
		}
		
		public function resize(w:Number,h:Number,s:Number = .75):void
		{
			var scale:Number = h / w;
			if (scale > s)
			{
				width = w;
				height = w * s;
				x = 0;
				y = (h - w * s) / 2
			}
			else
			{
				height = h;
				width = h / s;
				y = 0;
				x = (w - h / s) *.5;
			}
			
			dispatchEvent(new Event(Event.CHANGE));
		}
	}
}